package com.wans.guli.search.controller;

import com.wans.guli.common.utils.R;
import com.wans.guli.search.server.ProductService;
import com.wans.guli.search.vo.SkuEsRestVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@ResponseBody
@RequestMapping("/es/product")
public class ProductController {

    @Autowired
    @Qualifier("productServiceImpl")
    private ProductService productService;

    /**
     * 保存商品信息 - 商品上架
     * @param skuEsRestVOList sku商品信息
     * @return 保存结果
     */
    @PostMapping("/save")
    public R save(@RequestBody List<SkuEsRestVO> skuEsRestVOList) {
        // 保存商品数据到ES
        productService.save(skuEsRestVOList);

        return R.ok();
    }

}
